#!/bin/bash

# Loop through all items in the current directory
for file in *; do
    # Check if it's a file and contains a '?'
    if [ -f "$file" ] && [[ "$file" == *\?* ]]; then
        # Remove everything from '?' onwards using parameter expansion
        newname="${file%%\?*}"
        # Rename the file (-- handles filenames starting with hyphens)
        mv -- "$file" "$newname"
        # Print the rename operation for verification
        echo "Renamed: $file -> $newname"
    fi
done

